﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Data;
using System.Data.SqlClient;

/// <summary>
/// Summary description for BillDto
/// </summary>
public class BillDto
{
    #region "variable"
    private int id_Bill;    
    private int id_MN;
    private int id_SD;   
    private int id_Staff;    
    private string _createDate;    
    private string _paymentDate;    
    private bool _billStatus;    
    #endregion

    #region "properties"
    public int Id_Bill
    {
        get { return id_Bill; }
        set { id_Bill = value; }
    }
    public int Id_MN
    {
        get { return id_MN; }
        set { id_MN = value; }
    }
    public int Id_SD
    {
        get { return id_SD; }
        set { id_SD = value; }
    }
    public int Id_Staff
    {
        get { return id_Staff; }
        set { id_Staff = value; }
    }
    public string CreateDate
    {
        get { return _createDate; }
        set { _createDate = value; }
    }
    public string PaymentDate
    {
        get { return _paymentDate; }
        set { _paymentDate = value; }
    }
    public bool BillStatus
    {
        get { return _billStatus; }
        set { _billStatus = value; }
    }
    #endregion

    public BillDto()
    {
    }
    public BillDto(DataRow row)
	{
        this.id_Bill = (int)row["id_Bill"];
        this.id_MN = (int)row["id_MN"];
        this.id_SD=(int)row["id_SD"];
        if (row["id_Staff"]==DBNull.Value)
        {
            this.id_Staff = -1;
        }
        else this.id_Staff = (int)row["id_Staff"];                
        this._createDate = DateTime.Parse(row["_createDate"].ToString()).ToString("dd/MM/yyyy");
        this._billStatus = bool.Parse(row["_billStatus"].ToString());
        if (this._billStatus)
        {
            this._paymentDate = DateTime.Parse(row["_paymentDate"].ToString()).ToString("dd/MM/yyyy");
        }
        else this._paymentDate = "";
	}
    public BillDto(string id_MN, string id_SD, string _createDate, string _paymentDate,bool _billStatus)
    {
        this.id_SD =int.Parse(id_SD);
        this.id_MN = int.Parse(id_MN);
        this._createDate = DateTime.Parse(_createDate).ToString("dd/MM/yyyy");
        this._paymentDate = DateTime.Parse(_paymentDate).ToString("dd/MM/yyyy");
        this._billStatus = _billStatus;
    }
}